// e67
import static java.lang.Math.*
t = (new File('triangle.txt').readLines()*.trim() - "").collect { row -> (row.split(/\s+/) - '')*.toInteger() }.reverse()
t[0..-2].eachWithIndex { row, idx ->
    for (i in 0..<row.size()-1) {
        t[idx+1][i] += max(row[i], row[i+1])
    }
}
println "==> ${t[-1][0]}"
